<?php
@header("Content-Type:text/html;charset=utf-8");
@header("Access-Control-Allow-Origin:*");
$user_name=$_GET["name"];
$user_pwd=$_GET["pwd"];
$user_phone=$_GET["phone"];
// echo $user_name,$user_pwd,$user_phone;
mysql_connect("localhost:3306","root","root");
mysql_select_db("1904");
mysql_query("set character set utf8");
mysql_query("set names utf8");
$result_name=mysql_query("select * from userinfo where user_name='$user_name'");
$result_phone=mysql_query("select * from userinfo where user_phone='$user_phone'");
$arr=array();
// echo $result;
if(mysql_fetch_row($result_name)){
   $arr["status"]=false;
   $arr["msg"]='name is fail';
   $arr["err"]="name";
}
else{
    if(mysql_fetch_row($result_phone)){
        $arr["status"]=false;
        $arr["msg"]='phone is fail'; 
        $arr["err"]="phone";
     }
     else{
    mysql_query("insert into userinfo(user_name,user_pwd,user_phone) value('$user_name','$user_pwd','$user_phone')");    
    if(mysql_affected_rows()>0){
    $arr["status"]=true;
    $arr["msg"]="userinfo"; 
    }
    else{
    $arr["status"]=false;
    $arr["msg"]="db error";  
    }
   }
}
echo json_encode($arr);

// mysql_query("insert into userinfo(user_name,user_pwd,user_phone) value('$user_name','$user_pwd','$user_phone')");
// mysql_query('delete from userinfo where id=26 or id=27');
?>